<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="order by dede58.com"/>
    <title>绑定身份</title>
    <link rel="stylesheet" type="text/css" href="css/jiazaitoubu.css">
    <link rel="stylesheet" type="text/css" href="css/css.css">
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/index2.js"></script>
    <link rel="stylesheet" type="text/css" href="css/center.css">
    <link rel="stylesheet" type="text/css" href="css/city.css">
    <script src="js/Popt.js"></script>
    <script src="js/cityJson.js"></script>
    <script src="js/citySet.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>
    <script src="js/common.js"></script>
    
</head>


<body>
<div id="app">	
<top></top>
<bar></bar>

<div class="centers_m">
   <bars></bars>
  <div class="public_m1">
            <div class="public_m2">实名认证</div>
            <!--提示信息-->
            <div class="tip_notem">
                <ul>
                    <li>1. 我们将对您的信息绝对保密</li>
                    <li>2. 认证可以提高信誉</li>
                    <li>3. 认证完全免费，认证成功后不可修改</li>
                </ul>
            </div>
            <div class="public_m4">
                <p>
                    <em><h1>真实姓名：</h1></em>
                    <input  type="text" v-model="newname" style=" height:30px; border:1px solid #eaeaea; width:240px">
                    <span style="color: #ff0000"v-if="seee">{{tishi}}</span>
                </p>
                <p>
                    <em><h1>身份证号：</h1></em>
                    <input  type="text" v-model="idcar" style=" height:30px; border:1px solid #eaeaea; width:240px">
                    <span style="color: #ff0000"v-if="see">{{tishi1}}</span>
                </p>
                <p>
                    <em><h1>上传身份证：</h1></em>
                    <input type="file" style=" height:30px; border:1px solid #eaeaea; width:240px">
                </p>
                <button class="public_m3" @click="changeSafe" :disabled="dis">提交认证</button>
            </div>
        </div>
    </div>
    <end></end>
    </div>
</body>
</html>

<script>
    var app = new Vue({
        el:"#app",
        data: {
            userinfo: {
                id: 1,
                profile: '',
            },
            admin: {},
            dis:null,

            showPass:false,
            showPas:false,
            newenable:'1',
            newname:'',
            idcar:'',
            tishi:'',
            tishi1:'',
            see: false,
            seee: false



        },
        created: function () {
            this.initData(1);//初始化方法
            this.changeSafe();
        },

        methods: {
            //数据初始化
            initData: function (pageNum) {

                axios.post("http://localhost:8080/manage/showUserinfoType?id=1")
                    //链接数据库
                    .then(res => {
                        console.log(res.data.data);
                        this.userinfo=res.data.data;

                        if(this.userinfo.loginIp==1)
                        {
                            this.dis = 'disabled';
                            alert("您已绑定身份证号，无法再次绑定")

                        }
                    });
            },


            changeSafe() {
                axios.post("http://localhost:8080/manage/updateidcard?id=1",this.userinfo)
                    .then(res=>{

                        if(this.newname!==''&this.idcar!=='')
                        {
                            alert("修改成功")
                            this.userinfo.name=this.newname,
                            this.userinfo.loginIp=this.newenable,
                            this.tishi='绑定成功',
                            this.tishi1='绑定成功'


                        }
                        if(this.newname==''&this.userinfo.loginIp!==1)
                        {
                            alert("姓名为空,请填写姓名"),

                            this.tishi='姓名为空'
                        }
                        if(this.idcar==''&this.userinfo.loginIp!==1)
                        {
                            alert("身份证为空，请填写身份证号"),
                            this.tishi1='身份证为空'
                        }

                    });
            },



        },

    });

</script>
<script type="text/javascript">
            $("#city").click(function (e) {
                SelCity(this,e);
            });
        </script>

<script>
     //模拟下拉菜单的js*/
     $(".sjhcp_in span").on("mouseenter", function(e)
        {
            if($(".little_list").is(":hidden"))
            {
                $(".little_list").show();
            }
            else
            {
                $(".little_list").hide();
            }
            $(".little_list em").click(function()
            {
                var txt=$(this).text();
                $(".sjhcp_in span").text(txt);
                $(".little_list").hide();
            })
            $(document).one("click", function()
            {
                $(".little_list").hide();
            });
            e.stopPropagation();
        });
            $(".little_list").on("click", function(e)
            {
                e.stopPropagation();
            });
     
      window.onload=function()
      {
        $(".aside").css({display:"none"})
        $(".important").mouseenter(function(){
            $(".aside").css({display:"block"})
        }).mouseleave(function(){
            $(".aside").css({display:"none"})
        })
    }
       
</script>